package com.xul.crowd.api;

import com.xul.crowd.util.ResultEntity;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.concurrent.TimeUnit;

/**
 * @author xul
 * @create 2021-07-29 13:21
 */
@FeignClient("xul-crowd-redis")
@Repository
public interface RedisRemoteService {

    /**
     * 设置验证码手机号 验证码 超时时间到redis 让auth远程调用
     *
     * @param key
     * @param value
     * @param time
     * @param timeUnit
     * @return
     */
    @RequestMapping("set/redis/key/value/remote/with/timeout")
    public ResultEntity<String> setRedisKeyValueRemoteWithTimeout(@RequestParam("key") String key,
                                                                  @RequestParam("value") String value,
                                                                  @RequestParam("time") long time,
                                                                  @RequestParam("timeUnit") TimeUnit timeUnit);

    /**
     * 通过key(手机号拼接的字符串)从redis中查询验证码的信息 让auth远程调用
     *
     * @param key
     * @return
     */
    @RequestMapping("get/redis/string/value/by/key/remote")
    public ResultEntity<String> getRedisStringValueByKeyRemote(@RequestParam("key") String key);

    /**
     * 通过key(手机号拼接的字符串)从redis中删除验证码的信息 让auth远程调用
     *
     * @param key
     * @return
     */
    @RequestMapping("remove/redis/key/remote")
    public ResultEntity<String> removeRedisKeyRemote(@RequestParam("key") String key);


}
